package cn.yangliu.ui;

import cn.yangliu.bean.*;
import cn.yangliu.comm.tools.StringUtils;
import cn.yangliu.gennerator.GeneratorHandler;
import cn.yangliu.source.*;
import cn.yangliu.tools.CodeUtils;
import cn.yangliu.tools.Constans;
import cn.yangliu.tools.DBUtils;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;

import javax.swing.*;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Objects;
import java.util.Vector;

public class MainSettingUI extends JDialog {
    private JPanel containerPanel;
    private JList<String> tableList;
    private JTextField hostLinkTF;
    private JTextField portLinkTF;
    private JPanel linkPanel;
    private JTextField userLinkTF;
    private JTextField passwordLinkTF;
    private JTextField databaseLinkTF;
    private JButton linkButton;
    private JPanel settingPanel;
    private JScrollPane listScrollPane;
    private JTextField projectPackageTF;
    private JTextField codePathTF;
    private JCheckBox lombokCheckBox;
    private JCheckBox serviceCheckBox;
    private JCheckBox controllerCheckBox;
    private JTextField tablePrefixTF;
    private JPanel entitySettingPanel;
    private JTextField entityPackageTF;
    private JTextField primaryKeyNameTF;
    private JTextField primaryKeyTypeTF;
    private JButton dbType2JavaTypeButton;
    private JCheckBox equalsAndhashcodeCheckBox;
    private JCheckBox toStringCheckBox;
    private JCheckBox noArgConstructorCheckBox;
    private JCheckBox chainCheckBox;
    private JTextField superClassTF;
    private JTextField excludeColumnTF;
    private JPanel mapperSettingPanel;
    private JTextField mapperPackageTF;
    private JTextField mapperClassSufixTF;
    private JCheckBox baseMapperCheckBox;
    private JCheckBox mapperAnnotationCheckBox;
    private JTextField servicePackageTF;
    private JCheckBox createInterfaceCheckBox;
    private JCheckBox baseServiceCheckBox;
    private JCheckBox transcationalAnnotationCheckBox;
    private JPanel serviceSettingPanel;
    private JPanel controllerSettingPanel;
    private JTextField controllerPackageTF;
    private JTextField returnTypeTF;
    private JCheckBox restfulCheckBox;
    private JTextField returnTypeStaticMethdTF;
    private JPanel projectSettingPanel;
    private JPanel buttonPanel;
    private JButton sureButton;
    private JButton cancelButton;
    private JLabel projectSettingLable;
    private JLabel entitySettingLable;
    private JLabel mapperSettingLable;
    private JLabel serviceSettingLable;
    private JButton cancelLinkButton;
    private JPanel _1PanelGroup;
    private JPanel _2panelGroup;
    private JPanel _3PanelGroup;
    private JPanel _4PanelGroup;
    private JPanel _5PanelGroup;
    private JPanel _6PanelGroup;
    private JPanel _7PanelGroup;
    private JPanel _8PanelGroup;
    private JPanel _9PanelGroup;
    private JPanel _10PanelGroup;
    private JPanel _11PanelGroup;
    private JPanel _15PanelGroup;
    private JPanel listPanel;
    private JPanel projectSettingLablePanel;
    private JPanel entitySettingLablePanel;
    private JPanel mapperSettingLablePanel;
    private JPanel serviceSettingLablePanel;
    private JPanel controllerSettingLablePanel;
    private JPanel controllerSettingContentPanel;
    private JPanel serviceSettingContentPanel;
    private JPanel mapperSettingContentPanel;
    private JPanel entitySettingContentPanel;
    private JPanel projectSettingContentPanel;
    private JPanel entitySettingContentPanelNorth;
    private JPanel entitySettingContentPanelSouth;
    private JLabel controllerSettingLable;
    private JPanel _12PanelGroup;
    private JPanel _13PanelGroup;
    private JPanel _14PanelGroup;
    private JPanel projectSettingPanelNorth;
    private JPanel projectSettingPanelSouth;
    private JPanel entitySettingContentPanelCenter;

    private Project project;

    private MappingUI mappingUI;

    private GeneratorHandler handler;


    private static final int WINDOW_WIDTH = 1200;
    private static final int WINDOW_HEIGHT = 600;

    public MainSettingUI(Project project) {
        this.project = project;
        addActionListener();
        init();
        setContentPane(containerPanel);
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        int width = toolkit.getScreenSize().width;
        int height = toolkit.getScreenSize().height;
        int x = (width - WINDOW_WIDTH) / 2;
        int y = (height - WINDOW_HEIGHT) / 2;
        setLocation(x, y);
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        Dimension dimension = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT);
        setMaximumSize(dimension);
        setMinimumSize(dimension);

        hostLinkTF.setText("127.0.0.1");
        userLinkTF.setText("root");
        passwordLinkTF.setText("root");
        databaseLinkTF.setText("test");
    }

    private static final int DEFUALT_HEIGHT = 50;

    private void addActionListener() {
        cancelLinkButton.setEnabled(false);
        linkButton.addActionListener((e) -> {
            String host = hostLinkTF.getText();
            String port = portLinkTF.getText();
            String user = userLinkTF.getText();
            String password = passwordLinkTF.getText();
            String database = databaseLinkTF.getText();
            Constans.linkInfo = new LinkInfo(user, password, host, port, "mysql", database);
            Vector<String> tables = DBUtils.getTables(Constans.linkInfo);
            tableList.setListData(tables);

            tableList.updateUI();

            cancelLinkButton.setEnabled(true);
            linkButton.setEnabled(false);
        });
        cancelLinkButton.addActionListener((e) -> {
            linkButton.setEnabled(true);
            cancelLinkButton.setEnabled(false);
            DBUtils.closeConnection();
        });

        cancelButton.addActionListener(e -> {
            init();
            this.setVisible(false);
            DBUtils.closeConnection();
        });
        dbType2JavaTypeButton.addActionListener(e -> {
            if (!mappingUI.isShowing()) {
                mappingUI.setVisible(true);
                mappingUI.setAlwaysOnTop(true);
            }
        });

        sureButton.addActionListener(e -> {

            if (!DBUtils.checkConnection()) {
                tip("请先连接数据库");
                return;
            }

            ProjectSetting projectSetting = new ProjectSetting();

            String codePath = codePathTF.getText();
            if (StringUtils.isEmpty(codePath)) {
                tip("请输入代码保存路径");
                return;
            }
            projectSetting.setCodePath(codePath);
            projectSetting.setCreateController(controllerCheckBox.isSelected());
            projectSetting.setCreateService(serviceCheckBox.isSelected());
            String projectPackage = projectPackageTF.getText();
            if (StringUtils.isEmpty(projectPackage)) {
                tip("请输入项目包名");
                return;
            }
            projectSetting.setProjectPackage(projectPackage);


            String tablePrefix = tablePrefixTF.getText();
            projectSetting.setTablePrefix(tablePrefix);
            projectSetting.setUseLombok(lombokCheckBox.isSelected());

            EntitySetting entitySetting = new EntitySetting();

            String entityPackage = entityPackageTF.getText();
            if (StringUtils.isEmpty(entityPackage)) {
                tip("请输入entity包名");
                return;
            }
            entitySetting.setEntityPackage(entityPackage);
            entitySetting.setBaseClassFullName(superClassTF.getText());
            entitySetting.setEqualAndHash(equalsAndhashcodeCheckBox.isSelected());
            entitySetting.setToString(toStringCheckBox.isSelected());
            entitySetting.setNoArgConstructor(noArgConstructorCheckBox.isSelected());
            entitySetting.setChain(chainCheckBox.isSelected());
            entitySetting.setUseBaseClass(StringUtils.isNotEmpty(superClassTF.getText()));
            entitySetting.setExcludeColumns(excludeColumnTF.getText());

            String primaryKeyName = primaryKeyNameTF.getText();
            if (StringUtils.isEmpty(primaryKeyName)) {
                tip("请输入主键名");
                return;
            }
            entitySetting.setPrimaryKeyName(primaryKeyName);
            String primaryKeyType = primaryKeyTypeTF.getText();

            if (StringUtils.isEmpty(primaryKeyType)) {
                tip("请输入主键类型");
                return;
            }
            entitySetting.setPrimaryKeyType(primaryKeyType);


            MapperSetting mapperSetting = new MapperSetting();

            String mapperPackage = mapperPackageTF.getText();
            if (StringUtils.isEmpty(mapperPackage)) {
                tip("请输入mapper包名");
                return;
            }
            mapperSetting.setMapperPackage(mapperPackage);

            String mapperClassSufix = mapperClassSufixTF.getText();
            if (StringUtils.isEmpty(mapperClassSufix)) {
                tip("请输入接口后缀");
                return;
            }
            mapperSetting.setMapperSufix(mapperClassSufix);
            mapperSetting.setExtendBaseMapper(baseMapperCheckBox.isSelected());
            mapperSetting.setUseMapperAnonntation(mapperAnnotationCheckBox.isSelected());


            ServiceSetting serviceSetting = new ServiceSetting();

            String servicePackage = servicePackageTF.getText();
            if (StringUtils.isEmpty(servicePackage)) {
                tip("请输入service包名");
                return;
            }
            serviceSetting.setServicePackage(servicePackage);
            serviceSetting.setCreateInterface(createInterfaceCheckBox.isSelected());
            serviceSetting.setUseBaseService(baseServiceCheckBox.isSelected());
            serviceSetting.setUseTransactional(transcationalAnnotationCheckBox.isSelected());


            ControllerSetting controllerSetting = new ControllerSetting();

            String controllerPackage = controllerPackageTF.getText();
            if (StringUtils.isEmpty(controllerPackage)) {
                tip("请输入controller包名");
                return;
            }
            controllerSetting.setControllerPackage(controllerPackage);
            controllerSetting.setUseRestful(restfulCheckBox.isSelected());
            controllerSetting.setMethodReturnTypeFullName(returnTypeTF.getText());
            controllerSetting.setReturnTypeStaticMethod(returnTypeStaticMethdTF.getText());


            List<String> tables = tableList.getSelectedValuesList();
            if (tables.isEmpty()) {
                tip("请选择表");
                return;
            }
            List<DBUtils.TableInfo> tablesInfo = DBUtils.getTablesInfo(Constans.linkInfo, tables);

            for (DBUtils.TableInfo tableInfo : tablesInfo) {
                String entityName = CodeUtils.getClassName(tableInfo.getName(), tablePrefix);
                EntitySource entitySource = new EntitySource(projectSetting, entitySetting, entityName, tableInfo);
                MapperSource mapperSource = new MapperSource(projectSetting, mapperSetting, entitySource);
                ServiceImplSource serviceImplSource = new ServiceImplSource(projectSetting, serviceSetting, mapperSource);
                ControllerSource controllerSource = new ControllerSource(projectSetting, controllerSetting, serviceImplSource);
                XmlSource xmlSource = new XmlSource(projectSetting, mapperSetting, mapperSource, entityName);

                handler.doGenerator(projectSetting, entitySource, mapperSource, xmlSource, serviceImplSource, controllerSource);

            }


            VirtualFile workspaceFile = project.getWorkspaceFile();
            VirtualFile projectFile = project.getProjectFile();

            if (Objects.nonNull(workspaceFile)) {
                workspaceFile.refresh(false, true);
            }
            if (Objects.nonNull(projectFile)) {
                projectFile.refresh(false, true);
            }
            tip("代码生成完成");

        });
    }

    private void init() {
        handler = new GeneratorHandler();
        mappingUI = new MappingUI();
        Field[] fields = this.getClass().getDeclaredFields();
        Dimension settingLableDimension = new Dimension(110, DEFUALT_HEIGHT);
        Dimension checkBoxDimension = new Dimension(200, 35);
        Dimension groupDimension = new Dimension(200, DEFUALT_HEIGHT);
        for (Field field : fields) {
            String fieldName = field.getName();
            try {
                if (field.getType().equals(JCheckBox.class)) {
                    JCheckBox checkBox = (JCheckBox) field.get(this);
                    if (!Objects.equals(fieldName, "restfulCheckBox")) {
                        checkBox.setSelected(true);
                    }
                    checkBox.setPreferredSize(checkBoxDimension);
                    checkBox.setHorizontalAlignment(SwingConstants.CENTER);

                } else if (fieldName.endsWith("SettingLable")) {
                    JLabel label = (JLabel) field.get(this);
                    label.setPreferredSize(settingLableDimension);
                } else if (fieldName.endsWith("PanelGroup")) {
                    JPanel panel = (JPanel) field.get(this);
                    panel.setPreferredSize(groupDimension);
                } else if (fieldName.endsWith("LinkTF")) {
                    JTextField textField = (JTextField) field.get(this);
                    textField.setPreferredSize(new Dimension(100, 35));
                }
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

        tablePrefixTF.setText("t_");
        entityPackageTF.setText("entity");
        primaryKeyNameTF.setText("id");
        primaryKeyTypeTF.setText("java.lang.Long");
        superClassTF.setText("");
        mapperPackageTF.setText("mapper");
        mapperClassSufixTF.setText("Mapper");
        excludeColumnTF.setText("");
        servicePackageTF.setText("service");
        controllerPackageTF.setText("web");
        returnTypeTF.setText("");
        returnTypeStaticMethdTF.setText("");
        dbType2JavaTypeButton.setSize(new Dimension(100, 50));
        portLinkTF.setText("3306");
        listScrollPane.setPreferredSize(new Dimension(200, 400));
        listScrollPane.getHorizontalScrollBar().setVisible(false);
        listScrollPane.getVerticalScrollBar().setVisible(true);
        codePathTF.setText(project.getBasePath());


        Dimension dimension = new Dimension(120, 40);
        codePathTF.setMaximumSize(dimension);
        codePathTF.setSize(dimension);
        codePathTF.setPreferredSize(dimension);
    }

    private void tip(String msg) {
        this.setAlwaysOnTop(false);
        Messages.showMessageDialog(project, msg, "提示", Messages.getInformationIcon());
    }


    {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        containerPanel = new JPanel();
        containerPanel.setLayout(new BorderLayout(0, 0));
        linkPanel = new JPanel();
        linkPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        containerPanel.add(linkPanel, BorderLayout.NORTH);
        final JLabel label1 = new JLabel();
        label1.setText("主机");
        linkPanel.add(label1);
        hostLinkTF = new JTextField();
        linkPanel.add(hostLinkTF);
        final JLabel label2 = new JLabel();
        label2.setText("端口");
        linkPanel.add(label2);
        portLinkTF = new JTextField();
        linkPanel.add(portLinkTF);
        final JLabel label3 = new JLabel();
        label3.setText("用户名");
        linkPanel.add(label3);
        userLinkTF = new JTextField();
        linkPanel.add(userLinkTF);
        final JLabel label4 = new JLabel();
        label4.setText("密码");
        linkPanel.add(label4);
        passwordLinkTF = new JTextField();
        linkPanel.add(passwordLinkTF);
        final JLabel label5 = new JLabel();
        label5.setText("库名");
        linkPanel.add(label5);
        databaseLinkTF = new JTextField();
        linkPanel.add(databaseLinkTF);
        linkButton = new JButton();
        linkButton.setLabel("连接");
        linkButton.setText("连接");
        linkPanel.add(linkButton);
        cancelLinkButton = new JButton();
        cancelLinkButton.setText("断开");
        linkPanel.add(cancelLinkButton);
        listPanel = new JPanel();
        listPanel.setLayout(new BorderLayout(0, 0));
        containerPanel.add(listPanel, BorderLayout.WEST);
        listScrollPane = new JScrollPane();
        listPanel.add(listScrollPane, BorderLayout.CENTER);
        tableList = new JList();
        tableList.setVisibleRowCount(10);
        listScrollPane.setViewportView(tableList);
        settingPanel = new JPanel();
        settingPanel.setLayout(new GridLayoutManager(6, 1, new Insets(0, 0, 0, 0), -1, -1));
        containerPanel.add(settingPanel, BorderLayout.CENTER);
        projectSettingPanel = new JPanel();
        projectSettingPanel.setLayout(new BorderLayout(0, 0));
        settingPanel.add(projectSettingPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        projectSettingLablePanel = new JPanel();
        projectSettingLablePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        projectSettingPanel.add(projectSettingLablePanel, BorderLayout.WEST);
        projectSettingLable = new JLabel();
        projectSettingLable.setHorizontalAlignment(0);
        projectSettingLable.setHorizontalTextPosition(0);
        projectSettingLable.setText("project配置");
        projectSettingLablePanel.add(projectSettingLable);
        projectSettingContentPanel = new JPanel();
        projectSettingContentPanel.setLayout(new BorderLayout(0, 0));
        projectSettingPanel.add(projectSettingContentPanel, BorderLayout.CENTER);
        projectSettingPanelNorth = new JPanel();
        projectSettingPanelNorth.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        projectSettingContentPanel.add(projectSettingPanelNorth, BorderLayout.NORTH);
        _1PanelGroup = new JPanel();
        _1PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        projectSettingPanelNorth.add(_1PanelGroup);
        final JLabel label6 = new JLabel();
        label6.setText("包名");
        _1PanelGroup.add(label6);
        projectPackageTF = new JTextField();
        _1PanelGroup.add(projectPackageTF);
        _2panelGroup = new JPanel();
        _2panelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        projectSettingPanelNorth.add(_2panelGroup);
        final JLabel label7 = new JLabel();
        label7.setText("代码路径");
        _2panelGroup.add(label7);
        codePathTF = new JTextField();
        _2panelGroup.add(codePathTF);
        _3PanelGroup = new JPanel();
        _3PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        projectSettingPanelNorth.add(_3PanelGroup);
        final JLabel label8 = new JLabel();
        label8.setText("表前缀");
        _3PanelGroup.add(label8);
        tablePrefixTF = new JTextField();
        _3PanelGroup.add(tablePrefixTF);
        projectSettingPanelSouth = new JPanel();
        projectSettingPanelSouth.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        projectSettingContentPanel.add(projectSettingPanelSouth, BorderLayout.SOUTH);
        lombokCheckBox = new JCheckBox();
        lombokCheckBox.setText("lombok注解");
        projectSettingPanelSouth.add(lombokCheckBox);
        serviceCheckBox = new JCheckBox();
        serviceCheckBox.setText("生成service");
        projectSettingPanelSouth.add(serviceCheckBox);
        controllerCheckBox = new JCheckBox();
        controllerCheckBox.setText("生成controller");
        projectSettingPanelSouth.add(controllerCheckBox);
        entitySettingPanel = new JPanel();
        entitySettingPanel.setLayout(new BorderLayout(0, 0));
        settingPanel.add(entitySettingPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        entitySettingLablePanel = new JPanel();
        entitySettingLablePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingPanel.add(entitySettingLablePanel, BorderLayout.WEST);
        entitySettingLable = new JLabel();
        entitySettingLable.setHorizontalAlignment(0);
        entitySettingLable.setHorizontalTextPosition(0);
        entitySettingLable.setText("entity配置");
        entitySettingLablePanel.add(entitySettingLable);
        entitySettingContentPanel = new JPanel();
        entitySettingContentPanel.setLayout(new BorderLayout(0, 0));
        entitySettingPanel.add(entitySettingContentPanel, BorderLayout.CENTER);
        entitySettingContentPanelNorth = new JPanel();
        entitySettingContentPanelNorth.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        entitySettingContentPanel.add(entitySettingContentPanelNorth, BorderLayout.NORTH);
        _4PanelGroup = new JPanel();
        _4PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelNorth.add(_4PanelGroup);
        final JLabel label9 = new JLabel();
        label9.setText("包名");
        _4PanelGroup.add(label9);
        entityPackageTF = new JTextField();
        _4PanelGroup.add(entityPackageTF);
        _5PanelGroup = new JPanel();
        _5PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelNorth.add(_5PanelGroup);
        final JLabel label10 = new JLabel();
        label10.setText("主键名");
        _5PanelGroup.add(label10);
        primaryKeyNameTF = new JTextField();
        primaryKeyNameTF.setText("");
        _5PanelGroup.add(primaryKeyNameTF);
        _6PanelGroup = new JPanel();
        _6PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelNorth.add(_6PanelGroup);
        final JLabel label11 = new JLabel();
        label11.setText("主键类型");
        _6PanelGroup.add(label11);
        primaryKeyTypeTF = new JTextField();
        _6PanelGroup.add(primaryKeyTypeTF);
        _15PanelGroup = new JPanel();
        _15PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelNorth.add(_15PanelGroup);
        dbType2JavaTypeButton = new JButton();
        dbType2JavaTypeButton.setText("类型映射");
        _15PanelGroup.add(dbType2JavaTypeButton);
        entitySettingContentPanelSouth = new JPanel();
        entitySettingContentPanelSouth.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        entitySettingContentPanel.add(entitySettingContentPanelSouth, BorderLayout.SOUTH);
        _7PanelGroup = new JPanel();
        _7PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelSouth.add(_7PanelGroup);
        final JLabel label12 = new JLabel();
        label12.setText("超类全类名");
        _7PanelGroup.add(label12);
        superClassTF = new JTextField();
        _7PanelGroup.add(superClassTF);
        _8PanelGroup = new JPanel();
        _8PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        entitySettingContentPanelSouth.add(_8PanelGroup);
        final JLabel label13 = new JLabel();
        label13.setText("排除字段");
        _8PanelGroup.add(label13);
        excludeColumnTF = new JTextField();
        excludeColumnTF.setText("");
        _8PanelGroup.add(excludeColumnTF);
        entitySettingContentPanelCenter = new JPanel();
        entitySettingContentPanelCenter.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        entitySettingContentPanel.add(entitySettingContentPanelCenter, BorderLayout.CENTER);
        equalsAndhashcodeCheckBox = new JCheckBox();
        equalsAndhashcodeCheckBox.setText("equal和hashcode");
        entitySettingContentPanelCenter.add(equalsAndhashcodeCheckBox);
        toStringCheckBox = new JCheckBox();
        toStringCheckBox.setText("toString");
        entitySettingContentPanelCenter.add(toStringCheckBox);
        noArgConstructorCheckBox = new JCheckBox();
        noArgConstructorCheckBox.setText("无参构造");
        entitySettingContentPanelCenter.add(noArgConstructorCheckBox);
        chainCheckBox = new JCheckBox();
        chainCheckBox.setText("链式调用");
        entitySettingContentPanelCenter.add(chainCheckBox);
        mapperSettingPanel = new JPanel();
        mapperSettingPanel.setLayout(new BorderLayout(0, 0));
        settingPanel.add(mapperSettingPanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        mapperSettingLablePanel = new JPanel();
        mapperSettingLablePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        mapperSettingPanel.add(mapperSettingLablePanel, BorderLayout.WEST);
        mapperSettingLable = new JLabel();
        mapperSettingLable.setHorizontalAlignment(0);
        mapperSettingLable.setHorizontalTextPosition(0);
        mapperSettingLable.setText("mapper配置");
        mapperSettingLablePanel.add(mapperSettingLable);
        mapperSettingContentPanel = new JPanel();
        mapperSettingContentPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        mapperSettingPanel.add(mapperSettingContentPanel, BorderLayout.CENTER);
        _9PanelGroup = new JPanel();
        _9PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        mapperSettingContentPanel.add(_9PanelGroup);
        final JLabel label14 = new JLabel();
        label14.setText("包名");
        _9PanelGroup.add(label14);
        mapperPackageTF = new JTextField();
        _9PanelGroup.add(mapperPackageTF);
        _10PanelGroup = new JPanel();
        _10PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        mapperSettingContentPanel.add(_10PanelGroup);
        final JLabel label15 = new JLabel();
        label15.setText("后缀");
        _10PanelGroup.add(label15);
        mapperClassSufixTF = new JTextField();
        _10PanelGroup.add(mapperClassSufixTF);
        baseMapperCheckBox = new JCheckBox();
        baseMapperCheckBox.setText("基础Mapper");
        mapperSettingContentPanel.add(baseMapperCheckBox);
        mapperAnnotationCheckBox = new JCheckBox();
        mapperAnnotationCheckBox.setText("@Mapper");
        mapperSettingContentPanel.add(mapperAnnotationCheckBox);
        serviceSettingPanel = new JPanel();
        serviceSettingPanel.setLayout(new BorderLayout(0, 0));
        settingPanel.add(serviceSettingPanel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        serviceSettingLablePanel = new JPanel();
        serviceSettingLablePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        serviceSettingPanel.add(serviceSettingLablePanel, BorderLayout.WEST);
        serviceSettingLable = new JLabel();
        serviceSettingLable.setHorizontalAlignment(0);
        serviceSettingLable.setHorizontalTextPosition(0);
        serviceSettingLable.setText("service配置");
        serviceSettingLablePanel.add(serviceSettingLable);
        serviceSettingContentPanel = new JPanel();
        serviceSettingContentPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        serviceSettingPanel.add(serviceSettingContentPanel, BorderLayout.CENTER);
        _11PanelGroup = new JPanel();
        _11PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        serviceSettingContentPanel.add(_11PanelGroup);
        final JLabel label16 = new JLabel();
        label16.setText("包名");
        _11PanelGroup.add(label16);
        servicePackageTF = new JTextField();
        _11PanelGroup.add(servicePackageTF);
        createInterfaceCheckBox = new JCheckBox();
        createInterfaceCheckBox.setText("创建接口");
        serviceSettingContentPanel.add(createInterfaceCheckBox);
        baseServiceCheckBox = new JCheckBox();
        baseServiceCheckBox.setText("基础service");
        serviceSettingContentPanel.add(baseServiceCheckBox);
        transcationalAnnotationCheckBox = new JCheckBox();
        transcationalAnnotationCheckBox.setText("事物注解");
        serviceSettingContentPanel.add(transcationalAnnotationCheckBox);
        controllerSettingPanel = new JPanel();
        controllerSettingPanel.setLayout(new BorderLayout(0, 0));
        settingPanel.add(controllerSettingPanel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
        controllerSettingLablePanel = new JPanel();
        controllerSettingLablePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        controllerSettingPanel.add(controllerSettingLablePanel, BorderLayout.WEST);
        controllerSettingLable = new JLabel();
        controllerSettingLable.setText("controller配置");
        controllerSettingLablePanel.add(controllerSettingLable);
        controllerSettingContentPanel = new JPanel();
        controllerSettingContentPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        controllerSettingPanel.add(controllerSettingContentPanel, BorderLayout.CENTER);
        _12PanelGroup = new JPanel();
        _12PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        controllerSettingContentPanel.add(_12PanelGroup);
        final JLabel label17 = new JLabel();
        label17.setText("包名");
        _12PanelGroup.add(label17);
        controllerPackageTF = new JTextField();
        controllerPackageTF.setText("");
        _12PanelGroup.add(controllerPackageTF);
        restfulCheckBox = new JCheckBox();
        restfulCheckBox.setText("restful");
        controllerSettingContentPanel.add(restfulCheckBox);
        _13PanelGroup = new JPanel();
        _13PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        controllerSettingContentPanel.add(_13PanelGroup);
        final JLabel label18 = new JLabel();
        label18.setText("返回值类型");
        _13PanelGroup.add(label18);
        returnTypeTF = new JTextField();
        _13PanelGroup.add(returnTypeTF);
        _14PanelGroup = new JPanel();
        _14PanelGroup.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        controllerSettingContentPanel.add(_14PanelGroup);
        final JLabel label19 = new JLabel();
        label19.setText("静态方法");
        _14PanelGroup.add(label19);
        returnTypeStaticMethdTF = new JTextField();
        _14PanelGroup.add(returnTypeStaticMethdTF);
        buttonPanel = new JPanel();
        buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        containerPanel.add(buttonPanel, BorderLayout.SOUTH);
        sureButton = new JButton();
        sureButton.setText("确定");
        buttonPanel.add(sureButton);
        cancelButton = new JButton();
        cancelButton.setText("取消");
        buttonPanel.add(cancelButton);
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() {
        return containerPanel;
    }

}
